package org.jeecg.modules.jinke.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.jinke.entity.GdScysCorpInfo;
import org.jeecg.modules.jinke.mapper.GdScysCorpInfoMapper;
import org.jeecg.modules.jinke.service.IGdScysCorpInfoService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 企业信息（金科）
 * @Author: jeecg-boot
 * @Date:   2022-03-21
 * @Version: V1.0
 */
@Service
@DS("jinke_datasource")
public class GdScysCorpInfoServiceImpl extends ServiceImpl<GdScysCorpInfoMapper, GdScysCorpInfo> implements IGdScysCorpInfoService {


    @Override
    public List<GdScysCorpInfo> getFirstByBusinessCode(String businessCode) {
        Page<GdScysCorpInfo> page = new Page<>(1,10);
        LambdaQueryWrapper<GdScysCorpInfo> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(GdScysCorpInfo::getBusinessNo, businessCode);
        page = this.page(page, wrapper);
        List<GdScysCorpInfo> records = page.getRecords();
        if (records != null && records.size() > 0) {
            return records;
        }
        return new ArrayList<>();
    }
}
